<template>
	<!-- 平台管理 -->
	<view class="page-content">
		<!--内容-->
		<view class="page-body">
			<view class="user-box">
				<navigator hover-class="none" :url="`${item.url}`" class="box-ul" v-for="(item,index) in list"
					:key="index">
					<view class="box-li" v-if="item.state">
						<view class="box-li-l">
							<image class="box-li-l-img" :src="item.icon" :style="{width:item.iconw+'rpx',height:item.iconh+'rpx'}"></image>
							<view class="box-li-l-txt">{{item.name}}</view>
						</view>
						<view class="box-li-r icons icon-gengduo"></view>
					</view>
				</navigator>
			</view>
			<view class="user-box2" v-if="userInfo.type === 0">
				<view class="box-li" @click="tologinout">
					<view class="box-li-txt">解散团队</view>
				</view>
			</view>
		</view>
		<!--编辑框-->
		<w-popup :show="showtip" :type="type1" @change="change1">
			<view class="w-tip">
				<view class="w-tit">解散团队</view>
				<view class="w-con">
					<view class="txt-row">是否解散？</view>
				</view>
				<view class="w-but">
					<view class="w-but-txt" @click="cancel('tip')">取消</view>
					<view class="w-but-txt" @click="confirm">确认</view>
				</view>
			</view>
		</w-popup>
		
	</view>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from "vuex";
	import {
		indexInfos,
		delCompanys, //解散团队
	} from '@/common/api.js';
	import wPopup from '@/components/w-popup/w-popup2.vue';// 弹窗
	export default {
		components: {
			wPopup
		},
		data() {
			return {
				objdata: {
					name: '朱丽叶',
					mobile: '1388888888',
					head: '/static/data-img/face_2.jpg',
					lasttime: '2020-3-20',
				},
				showtip: false, //是否显示弹窗2
				content1: '顶部弹 popup',
				type1: '', //弹窗显示方式
				params:{
					id:''
				}

			}
		},
		computed: {
			...mapGetters(['companyInfo','userInfo','userRole']),
			list() {
				return [{
					icon: '/static/icon/icon-qy.png',
					name: '企业/团队/品牌',
					url: '/pages/brandCreation/brandList',
					iconw:'40',
					iconh:'38',
					state: true
				}, {
					icon: '/static/icon/icon-gngw.png',
					name: '功能岗位/权限',
					url: '/pages/user/permissions?pageType=power',
					iconw:'32',
					iconh:'36',
					state: this.userInfo.type === 0
				}, {
					icon: '/static/icon/icon-cpsx.png',
					name: '产品属性',
					url: '/pages/user/productAttribute?pageType=pro',
					iconw:'40',
					iconh:'42',
					state: this.userRole.proStatu
				}, {
					icon: '/static/icon/icon-popcz.png',
					name: 'POP材质',
					url: '/pages/user/permissions?pageType=popcz',
					iconw:'34',
					iconh:'32',
					state:  this.userRole.textureStatu
				}, {
					icon: '/static/icon/icon-popbm.png',
					name: 'POP编码',
					url: '/pages/user/productAttribute?pageType=pop',
					iconw:'34',
					iconh:'34',
					state:  this.userRole.popStatu
				}, {
					icon: '/static/icon/icon-djbm.png',
					name: '道具编码',
					url: '/pages/user/productAttribute?pageType=prop',
					iconw:'30',
					iconh:'32',
					state: this.userRole.propStatu
				}, {
					icon: '/static/icon/icon-gysbjd.png',
					name: '供应商报价单',
					url: '/pages/user/quotation',
					iconw:'36',
					iconh:'36',
					state:  this.userRole.quotationStatu
				},/* {
					icon: '/static/icon/icon-gysbjd.png',
					name: '测试',
					url: '/pages/test/test?pageType=pro',
					iconw:'36',
					iconh:'36',
					state: 1
				} */];
			}
		},
		onShow() {
			this.params.id = this.companyInfo.id;
		},
		methods: {
			confirm(){
				delCompanys({id:this.params.id}).then(res=>{
					if(res.code === 2000){
						uni.showToast({
							title:'解散成功！',
							icon:'none',
							duration: 2000
						})
						setTimeout(() => {
						uni.clearStorageSync();
						 uni.reLaunch({
						 	url: `/pages/login/login`
						 })
						}, 500)
					}else{
						uni.showToast({
							title:res.msg,
							icon:'none',
							duration: 2000
						})
					}
				})
			},
			//跳转会员中心
			toviplink(){
				uni.navigateTo({
					url: "/pages/user/vipContent"
				})
			},
			//跳转详细页
			todetail() {
				uni.navigateTo({
					url: "/pages/user/userInfo"
				})
			},
			//退出登录
			tologinout() {
				this.showtip = true;
				this.content1 = 'center';
				this.type1 = 'center';
			},
			//取消
			cancel(){
				this.show = false
				this.showtip = false
			},
			change1(e) {
				if (!e.show) {
					this.showtip = false
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	/* 提示窗口 */
	.w-tip {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		width: 70vw;
		border-radius: 10rpx;
		background-color: #fff;
		box-shadow: 0rpx 7rpx 7rpx 0rpx rgba(0, 0, 0, 0.1);
		margin: 30rpx auto 0;
	
		.w-tit {
			font-size: 36rpx;
			font-weight: bold;
			color: $font-color-3;
			line-height: 60rpx;
			height: 60rpx;
			margin-top: 20rpx;
			text-align: center;
		}
	
		.w-but {
			display: flex;
			font-size: 32rpx;
			font-weight: 400;
			color: $font-color-b3;
			height: 84rpx;
			line-height: 84rpx;
	
			.w-but-txt {
				flex: 1;
				text-align: center;
				border-right: 1rpx solid #f5f5f5;
			}
	
			.w-but-txt:last-of-type {
				border-right: none;
			}
		}
	
		.w-con {
			display: flex;
			text-align: center;
			font-weight: 400;
			padding: 30rpx 30rpx;
			border-bottom: 1rpx solid #f5f5f5;
			.txt-row{
				width: 100%;
				text-align: center;
				font-size: 28rpx;
				color: $font-color-9;
			}
		}
	}
	.titleNview-placing {
		height: var(--status-bar-height);
		box-sizing: content-box;
		background: $uni-bg-color;
		display: block;
		position: sticky;
		top: 0rpx;
		z-index: 9999;
		overflow: hidden
	}

	.page-content {
		width: 100%;
		height: 100%;
		background: $uni-bg-color-grey;
		border-top: 1rpx solid #f5f5f5;
		
		//内容
		.page-body {
			display: flex;
			flex-direction: column;
			.user-box,.user-box2 {
				display: flex;
				flex-direction: column;
				width: 100%;
				padding: 0 30rpx;
				margin-bottom: 10rpx;
				background: $uni-bg-color;
				.box-li {
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					height: 100rpx;
					border-bottom: 1rpx solid #f5f5f5;
					.box-li-l {
						display: flex;
						align-items: center;
						.box-li-l-img {
							width: 40rpx;
							height: 38rpx;
							margin-right: 18rpx;
						}
						.box-li-l-txt {
							text-align: center;
							font-size: 32rpx;
							font-weight: 400;
							color: $font-color-3;
						}
					}
					.box-li-txt{
						width: 100%;
						text-align: center;
						font-size: 32rpx;
						font-weight: 400;
						color: $font-color-r;
					}
				}
				.box-li-r {
					color: $font-color-9;
				}
			}
		}


	}
</style>
